package com.dodo.blog.exception;

import javax.validation.ConstraintViolation;
import java.util.HashSet;
import java.util.Set;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public class ValidationException
        extends BackendException
{
    private static final long serialVersionUID = 1L;

    private Set<ConstraintViolation> constraintViolations;

    @SuppressWarnings( value = "unchecked" )
    public <T> ValidationException( Set<ConstraintViolation<T>> constraintViolations )
    {
        this.constraintViolations = new HashSet<ConstraintViolation>( constraintViolations );
    }

    public static long getSerialVersionUID()
    {
        return serialVersionUID;
    }

    public Set<ConstraintViolation> getConstraintViolations()
    {
        return constraintViolations;
    }

    @Override
    public String toString()
    {
        return "ValidationException{" +
                "constraintViolations=" + constraintViolations +
                '}';
    }
}
